/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2025-07-09
 * Time:23:46
 */
public class SingletonLazy {
    //懒汉模式--在第一次使用的时候创建实例
    private static volatile SingletonLazy instance =null;
    public static SingletonLazy getInstance(){
        if (instance==null){
            synchronized (SingletonLazy.class){
                if (instance==null){
                    instance=new SingletonLazy();
                }
            }
        }
        return instance;
    }
    private SingletonLazy(){

    }

}
class Demo1{
    public static void main(String[] args) {

    }
}
